﻿using Industry.Framework.Common.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Web.Http;
using LitJson;

namespace api.onlyle.com.Controllers
{

    public class ReadController : ApiController
    {
        // GET api/<controller>
        Industry.Framework.Common.WebClient webClient = new Industry.Framework.Common.WebClient();
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/<controller>/5
        public string Getzh(string key)
        {
            string param = "&ps={0}&pl={1}&c=880EC2123406BF855E844916775C3218&v=1384149062202";
            string json = "";
            string value = ConfigHelper.GetConfigString("news") + param;
            value = string.Format(value, key, "10");
            string reposevalue = Regex.Unescape(webClient.GetHtml(value));
            JsonData jsonData = JsonMapper.ToObject(reposevalue);
            return reposevalue;
        }

        // POST api/<controller>
        public void Post([FromBody]string value)
        {
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
        }
    }
}